﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.CompositeUI;

namespace WPFCABShell.$safeprojectname$
{
	/// <summary>
	/// A base class for all presenters.
	/// </summary>
	/// <typeparam name="TView">
	/// The type of the view.
	/// </typeparam>
	public abstract class Presenter<TView>
	{
		private TView _view;
		private WorkItem _workItem;

		/// <summary>
		/// Gets or sets the view.
		/// </summary>
		public TView View
		{
			get
			{
				return _view;
			}
			set
			{
				_view = value;
				OnViewSet();
			}
		}

		/// <summary>
		/// Gets or sets the <see cref="WorkItem"/>.
		/// </summary>
		[ServiceDependency]
		public WorkItem WorkItem
		{
			get
			{
				return _workItem;
			}
			set
			{
				_workItem = value;
			}
		}

		protected virtual void OnViewSet()
		{
		}
	}
}
